function [residual,  w_post] = kappa_iterative_residual_diagnostic_belief(  dp,   w,    xK,   p,   lambda_post,  p_fitted,  par ) 
% Usage: kappa_iterative_residual( kp, par ) 
% 
% Given dp, solve for additional jumps without firesales
kappab= xK*dp;
yK = (1-w*xK)/(1-w);
kappah = yK*dp;
w_post = w .* (  1- kappab ) ./  ( 1- w*kappab - (1-w)*kappah )  ;

residual = 1 - p_fitted( w_post, lambda_post * ones(size(dp)) )/p - dp  + 10^4*(  (dp>par.max_jump) + (kappab>0.9999) );
